<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/lib/layui/css/layui.css" rel="stylesheet"/>
    <link href="/css/common.css" rel="stylesheet"/>
    <title>基础平台</title>
    <style>
        html, body {
            height: 100%
        }
    </style>
</head>
<body class="layui-layout-body">
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <!-- 头部区域 -->
        <div class="layui-header">
            <ul class="layui-nav layui-layout-left" lay-filter="layadmin-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:void(0)" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item layadmin-refresh" lay-unselect>
                    <a href="javascript:void(0)" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:void(0)" layadmin-event="message" title="消息中心">
                        <i class="layui-icon layui-icon-notice"></i>
                        <!-- 如果有新消息，则显示小圆点 -->
                        <span class="layui-badge-dot"></span>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect style="margin-right: 30px">
                    <a href="javascript:void(0)">
                        <img class="layui-nav-img">
                        <cite id="name"></cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="/password.html" style="text-align: center">修改密码</a></dd>
                        <hr>
                        <dd style="text-align: center;"><a layadmin-event="logout" style="text-align: center">退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo" lay-href="/home.html">
                    <span>基础平台</span>
                </div>
                <ul class="layui-nav layui-nav-tree" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu"></ul>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:void(0)"></a>
                        <dl class="layui-nav-child layui-anim-fadein" style="z-index: 999">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:void(0)">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:void(0)">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:void(0)">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title">
                    <li lay-id="/home.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                </ul>
                <div class="layui-tab-content layui-body">
                    <div class="layui-tab-item layui-show">
                        <iframe src="/home.html" frameborder="0" class="layadmin-iframe"></iframe>
                    </div>
                </div>
            </div>
        </div>

        <!-- 辅助元素 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>
<script src="/lib/layui/layui.all.js" charset="utf-8"></script>
<script src="/script/common.js" charset="utf-8"></script>
<script src="/script/index.js" charset="utf-8"></script>
<script>
    layui.use(['baseUtil'], function () {
        var $ = layui.jquery,
            element = layui.element,
            baseUtil = layui.baseUtil;

        baseUtil.doGetData('/sysUser/info', {}, function (data) {
            $('#name').html(data.sysUser.userName);
            if (isBlank(data.sysUser.headLogo)) {
                $('.layui-nav-img').attr('src', '/image/info.jpg');
            } else {
                $('.layui-nav-img').attr('src', data.sysUser.headLogo);
            }
        });

        function getChildNav (data) {
            var str = '';
            for (var i = 0; i < data.length; i++) {
                var e = data[i];
                if (e.subs != null && e.subs.length > 0) {
                    str += '<dd><a href="javascript:void(0)">';
                    str += '<i class="layui-icon ' + e.icon + '"></i>';
                    str += '<cite class="layui-cite">' + e.title + '</cite>';
                    str += '</a>';
                    str += '<dl class="layui-nav-child">';
                    str += getChildNav(e.subs);
                    str += '</dl></dd>';
                } else {
                    str += '<dd><a lay-href="' + e.index + '">' + e.title + '</a></dd>';
                }
            }
            return str;
        }

        baseUtil.doGetData('/sysMenu/queryCurrentUserMenuList', {}, function (result) {
            var str = '';
            var data = result.data;
            for (var i = 0; i < data.length; i++) {
                var e = data[i];
                str += '<li class="layui-nav-item">';
                if (e.subs != null && e.subs.length > 0) {
                    str += '<a href="javascript:void(0)">';
                    if (isBlank(e.icon)) {
                        str += e.title;
                    } else {
                        str += '<i class="layui-icon ' + e.icon + '"></i>';
                        str += '<cite class="layui-cite">' + e.title + '</cite>';
                    }
                    str += '</a>';
                    str += '<dl class="layui-nav-child">';
                    str += getChildNav(e.subs);
                    str += '</dl>';
                } else {
                    str += '<a lay-href="' + e.index + '">';
                    if (isBlank(e.icon)) {
                        str += e.title;
                    } else {
                        str += '<i class="layui-icon ' + e.icon + '"></i>';
                        str += '<cite class="layui-cite">' + e.title + '</cite>';
                    }
                }
                str += '</li>';
            }
            $('.layui-nav-bar').remove();
            $('.layui-nav-tree').append(str);
            element.render('nav', 'layadmin-system-side-menu');
        });
    });
</script>
</body>
</html>
